if exists (select 1 from sysobjects where name = 'set_prsanstellung' and type = 'P')
begin
   drop procedure set_prsanstellung
   print 'Procedure: set_prsanstellung deleted ...'
end
go
create procedure set_prsanstellung(
  @prsid             int   = 1,
  @anstellungid      int   = 1,
  @von               varchar(8) = '20070101',
  @bis               varchar(8) = '20200101'
)
as
begin
  set nocount on

  declare @datevon  datetime
  declare @datebis  datetime
 
  select @datevon = convert(datetime, @von, 112)
  select @datebis = convert(datetime, @bis, 112)

   insert into PersonAnstellung (PrsID,AnstellungID,Von,Bis) values (@prsid, @anstellungid, @datevon,@datebis)
end
go
print 'Procedure: set_prsanstellung done ...'
go
grant exec on set_prsanstellung to prsadmins with grant option
go
grant exec on set_prsanstellung to prsusers
go

